import operate from '@dfeidao/atom-nodejs/db/operate';
// import query from '@dfeidao/atom-nodejs/db/query';
interface Message {
	formid: string;
	productid: string;
}
// interface PubForm {
// 	formid: string;
// }
export default async function atom(msg: Message, action_id: string, session_id: string, spaceid: string) {
	const systemid = '12';
	// const { exec, prepare } = query(action_id, session_id, systemid);
	// prepare('pub_form', ['formid'], { _id: msg._id, productid: msg.productid }, 10, 1, [], []);
	// const [data] = await exec<PubForm>();
	// const formid = data[0].formid;

	const { del, exec: e2 } = operate(action_id, session_id, systemid);

	del('pub_form', { formid: msg.formid, productid: msg.productid });
	del('pub_form_code', { formid: msg.formid, productid: msg.productid });
	const ret1 = await e2();

	if (ret1.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
